Skip to content

Conversation

@nnaydenow
Copy link
Contributor

@nnaydenow nnaydenow commented Oct 15, 2025

Scope and package --sap CSS variables with the web components package to improve theming reliability and prevent conflicts with external theme dependencies.

Some applications and custom themes rely on older versions of @sap-theming/theming-base-content, resulting in missing CSS variables when detected as external theming. This change ensures components have access to defined variables from newer versions when variables are not added externally, while allowing external variables to override defaults when present.

  • Prefix all CSS variables used variables from @sap-theming/theming-base-content with --ui5- to scope
  • Use default values from @sap-theming/theming-base-content as fallbacks per theme - each CSS variable is derived from the original name with default value per theme from theming base content as fallback
  • Apply --sap CSS variables only when externally defined
  • Decouple visual theme determination from component theme configuration - the visual active theme is determined by the loaded theming base content, independent of the theme set for web components. The components' theme setting only affects internal CSS variable mapping

Theme Behavior Expectation

Note: The following behavior applies when external CSS variables are detected when library is booting or when the theme is changing

Standard Theme (sap_horizon):

  • SAP variables: sap_horizon
  • Components: sap_horizon

Custom Theme (my_custom_theme extends sap_horizon):

  • SAP variables: my_custom_theme
  • Components: sap_horizon (maps to base theme)

Custom Theme (my_custom_theme extends sap_horizon, used theme is sap_fiori_3):

  • SAP variables: my_custom_theme
  • Components: sap_fiori_3

Fixes: #12446

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Oct 15, 2025

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 15, 2025 10:39 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 16, 2025 07:12 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 20, 2025 10:59 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 27, 2025 13:05 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 28, 2025 08:29 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 28, 2025 09:11 Inactive
@nnaydenow nnaydenow changed the title chore: WIP scope theming css variables with packages feat(framework): scope theming css variables with component packages Oct 30, 2025
@nnaydenow nnaydenow requested review from ilhan007, pskelin and vladitasev and removed request for pskelin and vladitasev October 30, 2025 11:49
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 30, 2025 11:58 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TabContainer]: CSS variables not loaded correctly // Scoping suffix issue?

3 participants